<?php


abstract class BaseAccountBonus extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $user_id;


	
	protected $code;


	
	protected $balance = 0;


	
	protected $bonus = 0;


	
	protected $download_today = 0;


	
	protected $download_this_week = 0;


	
	protected $download_this_month = 0;


	
	protected $download_total = 0;


	
	protected $bonus_download_today = 0;


	
	protected $bonus_download_this_week = 0;


	
	protected $bonus_download_this_month = 0;


	
	protected $bonus_download_total = 0;


	
	protected $set_today = 0;


	
	protected $set_this_week = 0;


	
	protected $set_this_month = 0;


	
	protected $set_total = 0;


	
	protected $bonus_set_today = 0;


	
	protected $bonus_set_this_week = 0;


	
	protected $bonus_set_this_month = 0;


	
	protected $bonus_set_total = 0;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getUserId()
	{

		return $this->user_id;
	}

	
	public function getCode()
	{

		return $this->code;
	}

	
	public function getBalance()
	{

		return $this->balance;
	}

	
	public function getBonus()
	{

		return $this->bonus;
	}

	
	public function getDownloadToday()
	{

		return $this->download_today;
	}

	
	public function getDownloadThisWeek()
	{

		return $this->download_this_week;
	}

	
	public function getDownloadThisMonth()
	{

		return $this->download_this_month;
	}

	
	public function getDownloadTotal()
	{

		return $this->download_total;
	}

	
	public function getBonusDownloadToday()
	{

		return $this->bonus_download_today;
	}

	
	public function getBonusDownloadThisWeek()
	{

		return $this->bonus_download_this_week;
	}

	
	public function getBonusDownloadThisMonth()
	{

		return $this->bonus_download_this_month;
	}

	
	public function getBonusDownloadTotal()
	{

		return $this->bonus_download_total;
	}

	
	public function getSetToday()
	{

		return $this->set_today;
	}

	
	public function getSetThisWeek()
	{

		return $this->set_this_week;
	}

	
	public function getSetThisMonth()
	{

		return $this->set_this_month;
	}

	
	public function getSetTotal()
	{

		return $this->set_total;
	}

	
	public function getBonusSetToday()
	{

		return $this->bonus_set_today;
	}

	
	public function getBonusSetThisWeek()
	{

		return $this->bonus_set_this_week;
	}

	
	public function getBonusSetThisMonth()
	{

		return $this->bonus_set_this_month;
	}

	
	public function getBonusSetTotal()
	{

		return $this->bonus_set_total;
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = AccountBonusPeer::ID;
		}

	} 
	
	public function setUserId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->user_id !== $v) {
			$this->user_id = $v;
			$this->modifiedColumns[] = AccountBonusPeer::USER_ID;
		}

	} 
	
	public function setCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->code !== $v) {
			$this->code = $v;
			$this->modifiedColumns[] = AccountBonusPeer::CODE;
		}

	} 
	
	public function setBalance($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->balance !== $v || $v === 0) {
			$this->balance = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BALANCE;
		}

	} 
	
	public function setBonus($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus !== $v || $v === 0) {
			$this->bonus = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS;
		}

	} 
	
	public function setDownloadToday($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->download_today !== $v || $v === 0) {
			$this->download_today = $v;
			$this->modifiedColumns[] = AccountBonusPeer::DOWNLOAD_TODAY;
		}

	} 
	
	public function setDownloadThisWeek($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->download_this_week !== $v || $v === 0) {
			$this->download_this_week = $v;
			$this->modifiedColumns[] = AccountBonusPeer::DOWNLOAD_THIS_WEEK;
		}

	} 
	
	public function setDownloadThisMonth($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->download_this_month !== $v || $v === 0) {
			$this->download_this_month = $v;
			$this->modifiedColumns[] = AccountBonusPeer::DOWNLOAD_THIS_MONTH;
		}

	} 
	
	public function setDownloadTotal($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->download_total !== $v || $v === 0) {
			$this->download_total = $v;
			$this->modifiedColumns[] = AccountBonusPeer::DOWNLOAD_TOTAL;
		}

	} 
	
	public function setBonusDownloadToday($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_download_today !== $v || $v === 0) {
			$this->bonus_download_today = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_DOWNLOAD_TODAY;
		}

	} 
	
	public function setBonusDownloadThisWeek($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_download_this_week !== $v || $v === 0) {
			$this->bonus_download_this_week = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_DOWNLOAD_THIS_WEEK;
		}

	} 
	
	public function setBonusDownloadThisMonth($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_download_this_month !== $v || $v === 0) {
			$this->bonus_download_this_month = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_DOWNLOAD_THIS_MONTH;
		}

	} 
	
	public function setBonusDownloadTotal($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_download_total !== $v || $v === 0) {
			$this->bonus_download_total = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_DOWNLOAD_TOTAL;
		}

	} 
	
	public function setSetToday($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->set_today !== $v || $v === 0) {
			$this->set_today = $v;
			$this->modifiedColumns[] = AccountBonusPeer::SET_TODAY;
		}

	} 
	
	public function setSetThisWeek($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->set_this_week !== $v || $v === 0) {
			$this->set_this_week = $v;
			$this->modifiedColumns[] = AccountBonusPeer::SET_THIS_WEEK;
		}

	} 
	
	public function setSetThisMonth($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->set_this_month !== $v || $v === 0) {
			$this->set_this_month = $v;
			$this->modifiedColumns[] = AccountBonusPeer::SET_THIS_MONTH;
		}

	} 
	
	public function setSetTotal($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->set_total !== $v || $v === 0) {
			$this->set_total = $v;
			$this->modifiedColumns[] = AccountBonusPeer::SET_TOTAL;
		}

	} 
	
	public function setBonusSetToday($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_set_today !== $v || $v === 0) {
			$this->bonus_set_today = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_SET_TODAY;
		}

	} 
	
	public function setBonusSetThisWeek($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_set_this_week !== $v || $v === 0) {
			$this->bonus_set_this_week = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_SET_THIS_WEEK;
		}

	} 
	
	public function setBonusSetThisMonth($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_set_this_month !== $v || $v === 0) {
			$this->bonus_set_this_month = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_SET_THIS_MONTH;
		}

	} 
	
	public function setBonusSetTotal($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->bonus_set_total !== $v || $v === 0) {
			$this->bonus_set_total = $v;
			$this->modifiedColumns[] = AccountBonusPeer::BONUS_SET_TOTAL;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->user_id = $rs->getInt($startcol + 1);

			$this->code = $rs->getString($startcol + 2);

			$this->balance = $rs->getInt($startcol + 3);

			$this->bonus = $rs->getInt($startcol + 4);

			$this->download_today = $rs->getInt($startcol + 5);

			$this->download_this_week = $rs->getInt($startcol + 6);

			$this->download_this_month = $rs->getInt($startcol + 7);

			$this->download_total = $rs->getInt($startcol + 8);

			$this->bonus_download_today = $rs->getInt($startcol + 9);

			$this->bonus_download_this_week = $rs->getInt($startcol + 10);

			$this->bonus_download_this_month = $rs->getInt($startcol + 11);

			$this->bonus_download_total = $rs->getInt($startcol + 12);

			$this->set_today = $rs->getInt($startcol + 13);

			$this->set_this_week = $rs->getInt($startcol + 14);

			$this->set_this_month = $rs->getInt($startcol + 15);

			$this->set_total = $rs->getInt($startcol + 16);

			$this->bonus_set_today = $rs->getInt($startcol + 17);

			$this->bonus_set_this_week = $rs->getInt($startcol + 18);

			$this->bonus_set_this_month = $rs->getInt($startcol + 19);

			$this->bonus_set_total = $rs->getInt($startcol + 20);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 21; 
		} catch (Exception $e) {
			throw new PropelException("Error populating AccountBonus object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(AccountBonusPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			AccountBonusPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(AccountBonusPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = AccountBonusPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += AccountBonusPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = AccountBonusPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = AccountBonusPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getUserId();
				break;
			case 2:
				return $this->getCode();
				break;
			case 3:
				return $this->getBalance();
				break;
			case 4:
				return $this->getBonus();
				break;
			case 5:
				return $this->getDownloadToday();
				break;
			case 6:
				return $this->getDownloadThisWeek();
				break;
			case 7:
				return $this->getDownloadThisMonth();
				break;
			case 8:
				return $this->getDownloadTotal();
				break;
			case 9:
				return $this->getBonusDownloadToday();
				break;
			case 10:
				return $this->getBonusDownloadThisWeek();
				break;
			case 11:
				return $this->getBonusDownloadThisMonth();
				break;
			case 12:
				return $this->getBonusDownloadTotal();
				break;
			case 13:
				return $this->getSetToday();
				break;
			case 14:
				return $this->getSetThisWeek();
				break;
			case 15:
				return $this->getSetThisMonth();
				break;
			case 16:
				return $this->getSetTotal();
				break;
			case 17:
				return $this->getBonusSetToday();
				break;
			case 18:
				return $this->getBonusSetThisWeek();
				break;
			case 19:
				return $this->getBonusSetThisMonth();
				break;
			case 20:
				return $this->getBonusSetTotal();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = AccountBonusPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getUserId(),
			$keys[2] => $this->getCode(),
			$keys[3] => $this->getBalance(),
			$keys[4] => $this->getBonus(),
			$keys[5] => $this->getDownloadToday(),
			$keys[6] => $this->getDownloadThisWeek(),
			$keys[7] => $this->getDownloadThisMonth(),
			$keys[8] => $this->getDownloadTotal(),
			$keys[9] => $this->getBonusDownloadToday(),
			$keys[10] => $this->getBonusDownloadThisWeek(),
			$keys[11] => $this->getBonusDownloadThisMonth(),
			$keys[12] => $this->getBonusDownloadTotal(),
			$keys[13] => $this->getSetToday(),
			$keys[14] => $this->getSetThisWeek(),
			$keys[15] => $this->getSetThisMonth(),
			$keys[16] => $this->getSetTotal(),
			$keys[17] => $this->getBonusSetToday(),
			$keys[18] => $this->getBonusSetThisWeek(),
			$keys[19] => $this->getBonusSetThisMonth(),
			$keys[20] => $this->getBonusSetTotal(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = AccountBonusPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setUserId($value);
				break;
			case 2:
				$this->setCode($value);
				break;
			case 3:
				$this->setBalance($value);
				break;
			case 4:
				$this->setBonus($value);
				break;
			case 5:
				$this->setDownloadToday($value);
				break;
			case 6:
				$this->setDownloadThisWeek($value);
				break;
			case 7:
				$this->setDownloadThisMonth($value);
				break;
			case 8:
				$this->setDownloadTotal($value);
				break;
			case 9:
				$this->setBonusDownloadToday($value);
				break;
			case 10:
				$this->setBonusDownloadThisWeek($value);
				break;
			case 11:
				$this->setBonusDownloadThisMonth($value);
				break;
			case 12:
				$this->setBonusDownloadTotal($value);
				break;
			case 13:
				$this->setSetToday($value);
				break;
			case 14:
				$this->setSetThisWeek($value);
				break;
			case 15:
				$this->setSetThisMonth($value);
				break;
			case 16:
				$this->setSetTotal($value);
				break;
			case 17:
				$this->setBonusSetToday($value);
				break;
			case 18:
				$this->setBonusSetThisWeek($value);
				break;
			case 19:
				$this->setBonusSetThisMonth($value);
				break;
			case 20:
				$this->setBonusSetTotal($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = AccountBonusPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setBalance($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setBonus($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setDownloadToday($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setDownloadThisWeek($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setDownloadThisMonth($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setDownloadTotal($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setBonusDownloadToday($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setBonusDownloadThisWeek($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setBonusDownloadThisMonth($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setBonusDownloadTotal($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setSetToday($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setSetThisWeek($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setSetThisMonth($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setSetTotal($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setBonusSetToday($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setBonusSetThisWeek($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setBonusSetThisMonth($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setBonusSetTotal($arr[$keys[20]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(AccountBonusPeer::DATABASE_NAME);

		if ($this->isColumnModified(AccountBonusPeer::ID)) $criteria->add(AccountBonusPeer::ID, $this->id);
		if ($this->isColumnModified(AccountBonusPeer::USER_ID)) $criteria->add(AccountBonusPeer::USER_ID, $this->user_id);
		if ($this->isColumnModified(AccountBonusPeer::CODE)) $criteria->add(AccountBonusPeer::CODE, $this->code);
		if ($this->isColumnModified(AccountBonusPeer::BALANCE)) $criteria->add(AccountBonusPeer::BALANCE, $this->balance);
		if ($this->isColumnModified(AccountBonusPeer::BONUS)) $criteria->add(AccountBonusPeer::BONUS, $this->bonus);
		if ($this->isColumnModified(AccountBonusPeer::DOWNLOAD_TODAY)) $criteria->add(AccountBonusPeer::DOWNLOAD_TODAY, $this->download_today);
		if ($this->isColumnModified(AccountBonusPeer::DOWNLOAD_THIS_WEEK)) $criteria->add(AccountBonusPeer::DOWNLOAD_THIS_WEEK, $this->download_this_week);
		if ($this->isColumnModified(AccountBonusPeer::DOWNLOAD_THIS_MONTH)) $criteria->add(AccountBonusPeer::DOWNLOAD_THIS_MONTH, $this->download_this_month);
		if ($this->isColumnModified(AccountBonusPeer::DOWNLOAD_TOTAL)) $criteria->add(AccountBonusPeer::DOWNLOAD_TOTAL, $this->download_total);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_DOWNLOAD_TODAY)) $criteria->add(AccountBonusPeer::BONUS_DOWNLOAD_TODAY, $this->bonus_download_today);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_DOWNLOAD_THIS_WEEK)) $criteria->add(AccountBonusPeer::BONUS_DOWNLOAD_THIS_WEEK, $this->bonus_download_this_week);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_DOWNLOAD_THIS_MONTH)) $criteria->add(AccountBonusPeer::BONUS_DOWNLOAD_THIS_MONTH, $this->bonus_download_this_month);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_DOWNLOAD_TOTAL)) $criteria->add(AccountBonusPeer::BONUS_DOWNLOAD_TOTAL, $this->bonus_download_total);
		if ($this->isColumnModified(AccountBonusPeer::SET_TODAY)) $criteria->add(AccountBonusPeer::SET_TODAY, $this->set_today);
		if ($this->isColumnModified(AccountBonusPeer::SET_THIS_WEEK)) $criteria->add(AccountBonusPeer::SET_THIS_WEEK, $this->set_this_week);
		if ($this->isColumnModified(AccountBonusPeer::SET_THIS_MONTH)) $criteria->add(AccountBonusPeer::SET_THIS_MONTH, $this->set_this_month);
		if ($this->isColumnModified(AccountBonusPeer::SET_TOTAL)) $criteria->add(AccountBonusPeer::SET_TOTAL, $this->set_total);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_SET_TODAY)) $criteria->add(AccountBonusPeer::BONUS_SET_TODAY, $this->bonus_set_today);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_SET_THIS_WEEK)) $criteria->add(AccountBonusPeer::BONUS_SET_THIS_WEEK, $this->bonus_set_this_week);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_SET_THIS_MONTH)) $criteria->add(AccountBonusPeer::BONUS_SET_THIS_MONTH, $this->bonus_set_this_month);
		if ($this->isColumnModified(AccountBonusPeer::BONUS_SET_TOTAL)) $criteria->add(AccountBonusPeer::BONUS_SET_TOTAL, $this->bonus_set_total);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(AccountBonusPeer::DATABASE_NAME);

		$criteria->add(AccountBonusPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setUserId($this->user_id);

		$copyObj->setCode($this->code);

		$copyObj->setBalance($this->balance);

		$copyObj->setBonus($this->bonus);

		$copyObj->setDownloadToday($this->download_today);

		$copyObj->setDownloadThisWeek($this->download_this_week);

		$copyObj->setDownloadThisMonth($this->download_this_month);

		$copyObj->setDownloadTotal($this->download_total);

		$copyObj->setBonusDownloadToday($this->bonus_download_today);

		$copyObj->setBonusDownloadThisWeek($this->bonus_download_this_week);

		$copyObj->setBonusDownloadThisMonth($this->bonus_download_this_month);

		$copyObj->setBonusDownloadTotal($this->bonus_download_total);

		$copyObj->setSetToday($this->set_today);

		$copyObj->setSetThisWeek($this->set_this_week);

		$copyObj->setSetThisMonth($this->set_this_month);

		$copyObj->setSetTotal($this->set_total);

		$copyObj->setBonusSetToday($this->bonus_set_today);

		$copyObj->setBonusSetThisWeek($this->bonus_set_this_week);

		$copyObj->setBonusSetThisMonth($this->bonus_set_this_month);

		$copyObj->setBonusSetTotal($this->bonus_set_total);


		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new AccountBonusPeer();
		}
		return self::$peer;
	}

} 